package com.thunder.rebot.rebotclient.activity;

import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;
import android.widget.Toast;

import com.thunder.rebot.rebotclient.service.ServiceClient;
import com.thunder.rebot.rebotclient.utils.TRCommonUtil;
import com.ts.robot.socket.lisetner.SocketLisetnerInterface;


/**
 * Created by yuechunan on 18-7-2.
 */

public class BaseActivity extends Activity implements ServiceClient.OnReceiveServiceListener, SocketLisetnerInterface {

    private static final String TAG = "BaseActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        init();
    }

    private void init() {
        TRCommonUtil.checkPermission(BaseActivity.this
                , new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE,
        Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_COARSE_LOCATION,
                        Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.CHANGE_WIFI_STATE,Manifest.permission.RECORD_AUDIO}, 200);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                           @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (grantResults.length > 0) {
            for (int result : grantResults) {
                if (result != PackageManager.PERMISSION_GRANTED)
                    return;
            }
            switch (requestCode) {
                case 200:
                    break;
            }
        } else {
            Toast.makeText(this, "该功能需要相机和读写文件权限", Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void getRebackType(Object value) {

    }

    @Override
    public void getRebackPicByte(byte[] pisByte,long id,int dataSize) {

    }

    @Override
    public void getInfoFaceData(String name, int x, int y, int w, int h) {

    }

    @Override
    public void getIsClear() {

    }

    @Override
    public void loginLisetner(int code) {

    }

    @Override
    public void getLocation(String x, String y, String z, String w) {

    }

    @Override
    public void conectState(int code, String description) {

    }

    @Override
    public void operateConfirm(Object o) {

    }

    @Override
    public void taskConfirm(Object o) {

    }

    @Override
    public void changeModeListener(Object o) {

    }

    @Override
    public void getSensorParam(Object obj) {

    }
}
